package com.jpyl.jpMedicalTreatment.network.api;

import com.jpyl.jpMedicalTreatment.model.AgentMessageModel;
import com.jpyl.jpMedicalTreatment.model.CompleteModel;
import com.jpyl.jpMedicalTreatment.model.DateOfCheckModel;
import com.jpyl.jpMedicalTreatment.model.DeliveryModel;
import com.jpyl.jpMedicalTreatment.model.IsSignModel;
import com.jpyl.jpMedicalTreatment.model.NewsMessageModel;
import com.jpyl.jpMedicalTreatment.model.OlderStateModel;
import com.jpyl.jpMedicalTreatment.model.OrderMessageModel;
import com.jpyl.jpMedicalTreatment.model.OutSituationModel;
import com.jpyl.jpMedicalTreatment.model.ProductsMessageModel;
import com.jpyl.jpMedicalTreatment.model.QueryUserModel;
import com.jpyl.jpMedicalTreatment.model.ResponseModel;
import com.jpyl.jpMedicalTreatment.model.RowsPeripheralModel;
import com.jpyl.jpMedicalTreatment.model.UserMessageModel;
import com.jpyl.jpMedicalTreatment.model.WeiXinPayModel;
import com.jpyl.jpMedicalTreatment.model.helper.DeliveryListModel;

import java.util.List;
import java.util.Map;

import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import rx.Observable;

/**
 * Created by LMX on 2017/1/10.
 */
public interface RequestApi {

    //登录
    @POST("jpylLogin")
    @FormUrlEncoded
    Observable<ResponseModel<UserMessageModel>> login(@Field("loginname") String username, @Field
            ("password") String password, @Field("location") String location);

    //退出登录
    @POST("jpylLogout")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylLogout(@Field("loginname") String username);

    //注册
    @POST("jpylRegister")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylRegister(@Field("loginname") String username, @Field
            ("password") String password, @Field("inviter") String inviter);


    //修改密码
    @POST("jpylChangePassword")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylChangePassword(@Field("loginname") String username,
                                                         @Field("oldPassword") String
                                                                 oldPassword, @Field
                                                                 ("newPassword") String
                                                                 newPassword);

    @POST("jpylRestorePassword")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylRestorePassword(@Field("loginname") String username);

    //通过id查询用户信息
    @POST("jpylQueryUserById")
    @FormUrlEncoded
    Observable<ResponseModel<QueryUserModel>> jpylQueryUserById(@Field("userid") String userid);

    //通过用户名查询用户信息
    @POST("jpylQueryUserByLoginname")
    @FormUrlEncoded
    Observable<ResponseModel<QueryUserModel>> jpylQueryUserByLoginname(@Field("loginname") String
                                                                               username);

    //代理商名称模糊查询
    @POST("jpylQueryAreaAgentByName")
    @FormUrlEncoded
    Observable<ResponseModel<List<AgentMessageModel>>> jpylQueryAreaAgentByName(@Field("name")
                                                                                        String
                                                                                        name);

    //代理商名称模糊查询
    @POST("jpylQueryAgentByName")
    @FormUrlEncoded
    Observable<ResponseModel<List<AgentMessageModel>>> jpylQueryAgentByName(@Field("name") String
                                                                                    name);

    //根据医生姓名模糊查询列表
    @POST("jpylQueryDoctorsByName")
    @FormUrlEncoded
    Observable<ResponseModel<List<AgentMessageModel>>> jpylQueryDoctorsByName(@Field("name")
                                                                                      String name);

    //大区代理查询代理
    @POST("jpylQueryMyAgentByName")
    @FormUrlEncoded
    Observable<ResponseModel<List<AgentMessageModel>>> jpylQueryMyAgentByName(@Field("userid") String
                                                                                userid, @Field
                                                                                ("name") String
            name);

    //模糊查询代理商的医生列表
    @POST("jpylQueryMyDoctorByName")
    @FormUrlEncoded
    Observable<ResponseModel<List<AgentMessageModel>>> jpylQueryMyDoctorByName(@Field("userid") String
                                                                                 userid, @Field
                                                                                 ("name") String
            name);

    //医生通过姓名模糊查询自己的病人
    @POST("jpylQueryMyPatientsByName")
    @FormUrlEncoded
    Observable<ResponseModel<List<AgentMessageModel>>> jpylQueryMyPatientsByName(@Field("userid")
                                                                                   String userid,
                                                                           @Field("name") String
                                                                                   name);

    //编辑信息提交
//    @POST("jpylEditUser")
//    @FormUrlEncoded
//    Observable<ResponseModel<Object>> jpylEditUser(@Field("user") String user);
//    @POST("jpylEditUser")
//    Observable<ResponseModel<Object>> jpylEditUser(@Body JsonObject body);
//    @GET("jpylEditUser")
//    Observable<ResponseModel<Object>> jpylEditUser(@Query("user") String user );
    @POST("jpylEditUser")
    @FormUrlEncoded
    Observable<ResponseModel<Object>> jpylEditUser(@FieldMap Map<String, String> paramsMap);


    //查询今天是否签到
    @POST("jpylCheckTodaySign")
    @FormUrlEncoded
    Observable<ResponseModel<IsSignModel>> jpylCheckTodaySign(@Field("userid") String userid);

    //签到
    @POST("jpylSign")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylSign(@Field("userid") String userid);

    //获得广告
    @GET("jpylGetAds")
    Observable<ResponseModel<RowsPeripheralModel>> jpylGetAds();

    //获取新闻
    @POST("jpylGetNews")
    @FormUrlEncoded
    Observable<ResponseModel<NewsMessageModel>> jpylGetNews(@Field("pageStr") String pageStr);

    //获取产品列表
    @POST("jpylGetProducts")
    @FormUrlEncoded
    Observable<ResponseModel<ProductsMessageModel>> jpylGetProducts(@Field("pageStr") String
                                                                            pageStr);

    //获取优惠产品列表
    @POST("jpylGetSaleProducts")
    @FormUrlEncoded
    Observable<ResponseModel<ProductsMessageModel>> jpylGetSaleProducts(@Field("pageStr") String
                                                                                pageStr);

    //获取积分可兑换产品列表
    @POST("jpylGetBypointProducts")
    @FormUrlEncoded
    Observable<ResponseModel<ProductsMessageModel>> jpylGetBypointProducts(@Field("pageStr")
                                                                                   String pageStr);

    @POST("jpylCheckUserCompleteInfo")
    @FormUrlEncoded
    Observable<ResponseModel<CompleteModel>> jpylCheckUserCompleteInfo(@Field("userid") String userid,
                                                                       @Field("pageStr") String pageStr);

    //获取用户hpv检测结果
    @POST("jpylGetHPV")
    @FormUrlEncoded
    Observable<ResponseModel<DateOfCheckModel>> jpylGetHPV(@Field("userid") String userid, @Field
            ("pageStr") String pageStr, @Field("dateFrom") long dateFrom, @Field("dateTo") long
                                                                   dateTo);

    //获取用户hp检测结果
    @POST("jpylGetHP")
    @FormUrlEncoded
    Observable<ResponseModel<DateOfCheckModel>> jpylGetHP(@Field("userid") String userid, @Field
            ("pageStr") String pageStr, @Field("dateFrom") long dateFrom, @Field("dateTo") long
                                                                  dateTo);

    //获取用户se检测结果
    @POST("jpylGetSe")
    @FormUrlEncoded
    Observable<ResponseModel<DateOfCheckModel>> jpylGetSe(@Field("userid") String userid, @Field
            ("pageStr") String pageStr, @Field("dateFrom") long dateFrom, @Field("dateTo") long
                                                                  dateTo);

    //投诉内容
    @POST("jpylComplain")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylComplain(@Field("userid") String userid, @Field
            ("content") String content);

    //商品下单
    @POST("jpylOrder")
    @FormUrlEncoded
    Observable<ResponseModel<OrderMessageModel>> jpylOrder(@Field("userid") String userid, @Field
            ("type") int type, @Field("province") String province, @Field("address") String
                                                                   address, @Field("productid")
            String productid, @Field("number") int number);

    //通过订单ID获得订单信息
    @POST("jpylGetOrderInfoById")
    @FormUrlEncoded
    Observable<ResponseModel<DeliveryModel>> jpylGetOrderInfoById(@Field("orderid") String
                                                                          orderid);

    //支付订单
    @POST("jpylPayOrder")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylPayOrder(@Field("userid") String userid, @Field
            ("orderid") String orderid);

    //支付宝预下单
    @POST("jpylGetZFBPayInfo")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylGetZFBPayInfo(@Field("orderid") String orderid);

    //微信预下单
    @POST("jpylGetWXPayInfo")
    @FormUrlEncoded
    Observable<ResponseModel<WeiXinPayModel>> jpylGetWXPayInfo(@Field("orderid") String orderid);

    //查询订单是否支付成功
    @POST("jpylCheckOrderPaySuccess")
    @FormUrlEncoded
    Observable<ResponseModel<OlderStateModel>> jpylCheckOrderPaySuccess(@Field("orderid") String
                                                                               orderid);

    //申请退款
    @POST("jpylTryRefundOrder")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylTryRefundOrder(@Field("userid") String userid, @Field
            ("orderid") String orderid);

    //取消订单
    @POST("jpylCancelOrder")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylCancelOrder(@Field("userid") String userid, @Field
            ("orderid") String orderid);

    //获得订单信息 0全部订单 1未支付 2未发货 3已发货 4申请退款
    @POST("jpylBuyerOrders")
    @FormUrlEncoded
    Observable<ResponseModel<DeliveryListModel>> jpylBuyerOrders(@Field("userid") String userid,
                                                                 @Field("pageStr") String
                                                                         pageStr, @Field("type")
                                                                         int type);

    //总供货商查询所有未发货和已发货订单（总供货商id，0未发货 1已发货）
    @POST("jpylOwnerShipOrders")
    @FormUrlEncoded
    Observable<ResponseModel<DeliveryListModel>> jpylOwnerShipOrders(@Field("userid")
                                                                                   String userid,
                                                                           @Field("pageStr")
                                                                                   String
                                                                                   pageStr,
                                                                           @Field("type") int type);

    //大区代理查询所有未发货和已发货订单（大区代理id，0未发货 1已发货）
    @POST("jpylAreaAgentShipOrders")
    @FormUrlEncoded
    Observable<ResponseModel<DeliveryListModel>> jpylAreaAgentShipOrders(@Field("userid")
                                                                                       String
                                                                                       userid,
                                                                               @Field("pageStr")
                                                                                       String
                                                                                       pageStr,
                                                                               @Field("type") int
                                                                                       type);

    //总供货商查询代理商出货情况.userid：总供货商id agentid：大区代理id
    @POST("jpylMyAreaAgentStatiticsForOwner")
    @FormUrlEncoded
    Observable<ResponseModel<OutSituationModel>> jpylMyAreaAgentStatiticsForOwner(@Field("userid") String
                                                                               userid, @Field
                                                                               ("agentid") String
            agentid, @Field("dateFrom") long dateFrom, @Field("dateTo") long dateTo);

    //大区代理id查询代理商出货情况
    @POST("jpylMyAgentStatiticsForAreaAgent")
    @FormUrlEncoded
    Observable<ResponseModel<OutSituationModel>> jpylMyAgentStatiticsForAreaAgent(@Field("userid") String
                                                                               userid, @Field
                                                                               ("pageStr") String
            pageStr, @Field("dateFrom") long dateFrom, @Field("dateTo") long dateTo);

    //总供货商和代理商查询医生的出货情况
    @POST("jpylMyDoctorStatitics")
    @FormUrlEncoded
    Observable<ResponseModel<Object>> jpylMyDoctorStatitics(@Field("userid") String userid,
                                                            @Field("doctorid") String doctorid,
                                                            @Field("dateFrom") long dateFrom,
                                                            @Field("dateTo") long dateTo);

    //代理商查询未出货和出货订单
    @POST("jpylAgentShipOrders")
    @FormUrlEncoded
    Observable<ResponseModel<DeliveryListModel>> jpylAgentShipOrders(@Field("userid") String
                                                                                userid, @Field
                                                                                ("pageStr")
            String pageStr, @Field("type") int type);

    //代理商查询医生或患者的出货量
    @POST("jpylAgentDPStatitics")
    @FormUrlEncoded
    Observable<ResponseModel<OutSituationModel>> jpylAgentDPStatitics(@Field("userid") String userid, @Field
            ("targetid") String targetid, @Field("type") int type, @Field("dateFrom") long
                                                                   dateFrom, @Field("dateTo") long
            dateTo);

    //医生查询自己患者的检测结果
    @POST("jpylMyPatientResults")
    @FormUrlEncoded
    Observable<ResponseModel<Object>> jpylMyPatientResults(@Field("userid") String userid, @Field
            ("patientid") String patientid, @Field("pageStr") String pageStr, @Field("type") int
                                                                   type);

    //医生查询患者未发货和已发货订单
    @POST("jpylMyPatientShipOrders")
    @FormUrlEncoded
    Observable<ResponseModel<Object>> jpylMyPatientShipOrders(@Field("userid") String userid,
                                                              @Field("patientid") String
                                                                      patientid, @Field
                                                                      ("pageStr") String pageStr,
                                                              @Field("type") int type);

    //医生查询患者出货统计
    @POST("jpylMyPatientStatistics")
    @FormUrlEncoded
    Observable<ResponseModel<OutSituationModel>> jpylMyPatientStatistics(@Field("userid") String userid,
                                                                         @Field("patientid") String
                                                                      patientid, @Field
                                                                      ("dateFrom") long dateFrom,
                                                                         @Field("dateTo") long dateTo);

    //防伪查询
    @POST("jpylValidateProduct")
    @FormUrlEncoded
    Observable<ResponseModel<String>> jpylValidateProduct(@Field("traceid") String traceid);

//    //  ip update
//    @PATCH("api/sampler/{samplerId}")
//    Observable<ResponseModel<SamplerByGPSNew>> ipUpdate(@Path("samplerId") String samplerId,
// @Body JsonObject body);

}
